/*************************************************************************
 *                                                                       *
 * This file is part of the FreeMAPs distribution.  For full copyright   *
 * information, see COPYRIGHT and COPYING.LESSER.                        *
 *                                                                       *
 * Author:           sqbang                                              *
 * Email:            sqbang@ustc.edu                                     *
 * Date:             2011.09.25                                          *
 *                                                                       *
 *************************************************************************/

#ifndef FreeMAPs_include_COMMON_bdry_IrregularBoundaryConditions_h
#define FreeMAPs_include_COMMON_bdry_IrregularBoundaryConditions_h

#include "FreeMAPsConfig.h"

//SAMRAI headers
#ifdef FREEMAPS_HAVE_SAMRAI
#  include "SAMRAI/hier/PatchHierarchy.h"
#  include "SAMRAI/hier/Patch.h"
#  include "SAMRAI/pdat/CellIndex.h"
#endif

//COMMON headers
#include "COMMON/base/StateIndicator.h"

namespace FreeMAPs
{

//forward declarations
#ifdef FREEMAPS_HAVE_SAMRAI
class StructuredDofMap;
#endif
class PDEEquationEnsembleStrategy;
class IrregularBoundaryConditionStrategy;
class Point;

/**
 * IrregularBoundaryConditions contains all the boundary conditions
 * that not impose on the boundary of the grid, but on the
 * level set zero contour(which will be set as a special boundary)
 *
 * @see Boundary.h
 */
class IrregularBoundaryConditions : public StateIndicator
{
public:

    typedef std::map<std::string, IrregularBoundaryConditionStrategy*>::const_iterator const_iterator;

public:

    IrregularBoundaryConditions (
        const std::string& parent_name,
        const std::string& object_name);

    virtual
    ~IrregularBoundaryConditions();

public:

    /**
     * judge whether this boundary condition is used.
     */
    inline bool
    is_used() const;

    inline const_iterator
    begin() const;

    inline const_iterator
    end() const;

    inline std::map<std::string, IrregularBoundaryConditionStrategy*>&
    get_boundaries();

    inline const std::map<std::string, IrregularBoundaryConditionStrategy*>&
    get_boundaries()const;


public:

    void
    clear();

    void
    get_from_input (
        const InputDatabase* db,
        const PDEEquationEnsembleStrategy* equation_ensemble);

    friend std::ostream&
    operator << (
        std::ostream& os,
        const IrregularBoundaryConditions& rhs);


private:
    typedef StateIndicator Parent;

    /*
     * map<bc_name, bc>
     */
    std::map<std::string, IrregularBoundaryConditionStrategy*> d_bdry_conds;


private:

    DISALLOW_COPY_AND_ASSIGN (IrregularBoundaryConditions);
};

}

#include "COMMON/bdry/IrregularBoundaryConditions.inl"

#endif
